#ifndef TIMERFD_H
#define TIMERFD_H
#include <functional>

class TimerFd
{
    using TimerFdCallback = std::function<void()>;
public:
    TimerFd(int initSec, int peridoSec, TimerFdCallback&& cb);
    ~TimerFd();
    void start();
    void stop();
    int createTimerFd();
    void handleRead();
    void setTimerFd(int initSec, int peridoSec);

private:
    int _timerfd;
    bool _isRunnning;
    int _initSec;
    int _peridoSec;
    TimerFdCallback _cb;

};

#endif //!__TIMERFD_H

